/*************************************************************************
	> File Name: P1734.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2024-12-27 15:42:27
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 1000
//打表求真因子和

int val[MAX_N + 5];

void init() {
    for (int i = 2; i <= MAX_N; i++) {
        val[i] = 1;
        for (int j = 2, I = sqrt(i); j <= I;j++) {
            if (i % j == 0) {
                int a = j, b = i / j;
                val[i] += a;
                if (a != b) val[i] += b;
            }
        }
    }
    return ;
}

int dp[MAX_N + 5];

int main() {
    init();
    int S;
    cin >> S;
    for (int i = 2; i <= S; i++) {
        for (int j = S; j >= i; j--) {
            dp[j] = max(dp[j], dp[j - i] + val[i]);
        }
    }
    cout << dp[S] << endl;
    return 0;
}
